' form level declarations for long filename support
Dim hInstKernel As Long
Dim lpGetShortPathNameA As Long
Dim lpFindFirstFileA As Long
' api calls for long filename support
Declare Function LoadLibraryEx32W Lib "KERNEL" (ByVal lpszFile As String, ByVal hFile As Long, ByVal dwFlags As Long) As Long
Declare Function FreeLibrary32W Lib "KERNEL" (ByVal hDllModule As Long) As Long
Declare Function GetProcAddress32W Lib "KERNEL" (ByVal hInstance As Long, ByVal FunctionName As String) As Long
Declare Function FindFirstFileA Lib "KERNEL" Alias "CallProc32W" (ByVal lpszFile As String, aFindFirst As WIN32_FIND_DATA, ByVal lpfnFunction As Long, ByVal fAddressConvert As Long, ByVal dwParams As Long) As Long
Declare Function GetShortPathNameA Lib "KERNEL" Alias "CallProc32W" (ByVal lpszLongFile As String, ByVal lpszShortFile As String, ByVal lBuffer As Long, ByVal lpfnFunction As Long, ByVal fAddressConvert As Long, ByVal dwParams As Long) As Long
Declare Function lcreat Lib "Kernel" Alias "_lcreat" (ByVal lpPathName As String, ByVal iAttribute As Integer) As Integer
Sub btnCancel_Click ()
gShortFilename = ""
gLongFilename = ""
LF.Action = -1
Unload Me
End Sub
' copyright 1996, Internet Software Engineering
Sub btnOpen_Click ()
Dim szShortFilename As String * 256
Dim p As Integer
Dim a As Long
Dim tmpstr As String
Dim hFile As Integer
Dim rtn As Integer
tmpstr = lblFolders.Caption
If Right$(tmpstr, 1) <> "\" Then tmpstr = tmpstr & "\"
gLongFilename = tmpstr & txtFilename.Text
'Convert the Long Filename to a Short Filename
If LF.Action = 2 And Not gIn16BitSystem Then ' create the file
hFile = lcreat(gLongFilename, 0)
If hFile = -1 Then
MsgBox "File error.", 16, App.Title
End If
End If
If Not gIn16BitSystem Then
a = GetShortPathNameA(gLongFilename, szShortFilename, 256&, lpGetShortPathNameA,